package ca.paulshin.yunatube.aboutyunatube;

import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import ca.paulshin.yunatube.R;
import ca.paulshin.yunatube.YunaTubeApplication;
import ca.paulshin.yunatube.YunaTubeBaseFragment;

public class AboutYunaTubeFragment extends YunaTubeBaseFragment {

	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.about_yunatube, null);

		TextView appVersion = (TextView) view.findViewById(R.id.app_version);
		String appVersionNumber = getString(R.string.app_version);
		try {
			appVersionNumber = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName;
		} catch (NameNotFoundException e) {
			if (YunaTubeApplication.debuggable) {
				e.printStackTrace();
			}
		}
		String appVersionDate = getString(R.string.app_version_date);
		appVersion.setText(appVersionNumber + " " + appVersionDate);

		return view;
	}

	@Override
	public int getTitle() {
		return R.string.supermenu_about_yunatube;
	}

	@Override
	protected boolean getNetworkCheck() {
		return false;
	}

	@Override
	protected String getTrackerId() {
		return "aboutyunatube";
	}
}
